home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / piblist.arc / SKIPS.PAS < prev   
Pascal/Delphi Source File  |  1985-03-01  |  6KB  |  109 lines

  1. (*----------------------------------------------------------------------*)
  2. (*              Skip_To_Line --- Skips to specified line in file F      *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. PROCEDURE Skip_To_Line( n: REAL );
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*   Procedure:   Skip_To_Line                                          *)
  10. (*                                                                      *)
  11. (*   Purpose:     Skips forward to specified line on file F.            *)
  12. (*                                                                      *)
  13. (*   Calling sequence:                                                  *)
  14. (*                                                                      *)
  15. (*      Skip_To_Line( n: REAL );                                        *)
  16. (*                                                                      *)
  17. (*         n  --- line to skip to                                       *)
  18. (*                                                                      *)
  19. (*   Calls:  Readln_F                                                   *)
  20. (*                                                                      *)
  21. (*   Remarks:                                                           *)
  22. (*                                                                      *)
  23. (*      Line  n  must exist.  File F must also be positioned at or      *)
  24. (*      before line  n.  On exit file F is positioned at line  n.       *)
  25. (*                                                                      *)
  26. (*----------------------------------------------------------------------*)
  27.  
  28. BEGIN  (* Skip_To_Line *)
  29.  
  30.    WHILE ( Cur_line < n ) DO
  31.       Readln_F;
  32.  
  33. END    (* Skip_To_Line *);
  34.  
  35. (*----------------------------------------------------------------------*)
  36. (*              Skip_To_Page --- Skips to specified page in file F      *)
  37. (*----------------------------------------------------------------------*)
  38.  
  39. PROCEDURE Skip_To_Page( n: REAL );
  40.  
  41. (*----------------------------------------------------------------------*)
  42. (*                                                                      *)
  43. (*   Procedure:   Skip_To_Page                                          *)
  44. (*                                                                      *)
  45. (*   Purpose:     Skips forward to specified page on file F.            *)
  46. (*                                                                      *)
  47. (*   Calling sequence:                                                  *)
  48. (*                                                                      *)
  49. (*      Skip_To_Page( n: REAL );                                        *)
  50. (*                                                                      *)
  51. (*         n  --- page to skip to                                       *)
  52. (*                                                                      *)
  53. (*   Calls:  Readln_F                                                   *)
  54. (*                                                                      *)
  55. (*   Remarks:                                                           *)
  56. (*                                                                      *)
  57. (*      Page  n  must exist.  File F must also be positioned at or      *)
  58. (*      before the first line of page n.  On exit file F is positioned  *)
  59. (*      at the first line of page n.                                    *)
  60. (*                                                                      *)
  61. (*----------------------------------------------------------------------*)
  62.  
  63. BEGIN  (* Skip_To_Page *)
  64.  
  65.    WHILE ( Cur_page < n ) DO
  66.       Readln_F;
  67.  
  68. END    (* Skip_To_Page *);
  69.  
  70. (*----------------------------------------------------------------------*)
  71. (*              Scan_to_Eof  -- Scan forward to end of file on F        *)
  72. (*----------------------------------------------------------------------*)
  73.  
  74. PROCEDURE Scan_To_Eof;
  75.  
  76. (*----------------------------------------------------------------------*)
  77. (*                                                                      *)
  78. (*   Procedure:   Scan_To_Eof                                           *)
  79. (*                                                                      *)
  80. (*   Purpose:     Skips forward to end of file on file F.               *)
  81. (*                                                                      *)
  82. (*   Calling sequence:                                                  *)
  83. (*                                                                      *)
  84. (*      Scan_To_Eof;                                                    *)
  85. (*                                                                      *)
  86. (*   Calls:  Readln_F                                                   *)
  87. (*           Reset_F                                                    *)
  88. (*                                                                      *)
  89. (*   Remarks:                                                           *)
  90. (*                                                                      *)
  91. (*      On entry Eof_Seen = FALSE.  On exit Eof_Seen = TRUE, Max_Line = *)
  92. (*      the largest line number on the file, and Max_Page = the largest *)
  93. (*      page number on the file.  On exit F is also reset.  This        *)
  94. (*      routine is called for large forward skips by the Find_Line and  *)
  95. (*      Find_Page routines.  It is called AT MOST ONCE per run of       *)
  96. (*      PibList.                                                        *)
  97. (*                                                                      *)
  98. (*----------------------------------------------------------------------*)
  99.  
  100. BEGIN  (* Scan_To_Eof *)
  101.  
  102.    WHILE NOT EOF( F ) DO
  103.       Readln_F;
  104.  
  105.    Eof_seen := TRUE;
  106.    Reset_F;
  107.  
  108. END    (* Scan_To_Eof *);
  109.